DEFINE BUFFER gltdet FOR glt_det.

OUTPUT TO s:\ch\hk\glt.txt.
FOR EACH glt_det WHERE glt_det.glt_batch = "1201" BY glt_det.glt_doc:
    FOR EACH gltdet WHERE gltdet.glt_doc = glt_det.glt_doc:
        ACCUMULATE gltdet.glt_doc (COUNT).
    END.

    IF (ACCUMU COUNT gltdet.glt_doc) < 3 THEN 
        NEXT.
    ELSE
        DISP glt_det.glt_doc glt_det.glt_ref 
             glt_det.glt_line glt_det.glt_acct 
             glt_det.glt_amt glt_det.glt_addr glt_det.glt_desc.
END.

OUTPUT CLOSE.
